[Mobile] - Add new KeyboardEvent.code attribute to RichText onKeyPress event#43521
Conversation
There was a problem hiding this comment.
I didn't use the values from @wordpress/keycodes just in case those get deprecated with this keyCode being deprecated effort.
|
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
I'd also suggest adding Space and Delete as those are used in #43442.
Feel free to borrow from this keymap if that helps: https://github.com/testing-library/user-event/blob/main/src/keyboard/keyMap.ts
There was a problem hiding this comment.
Great idea! I'll add those, thank you @tyxla 🙇
There was a problem hiding this comment.
Let me know if you need reviews FWIW. I owe you a few already 😉
dcalhoun
left a comment
There was a problem hiding this comment.
Thank you for addressing this issue! The outlined tests succeeded for me on an iPhone SE (iOS 16) and Samsung Galaxy S20 (Android 12). 🎉
I left a couple of comments for consideration. Let me know what you think. 🙇🏻
…anges on the web editor using KeyboardEvent.code since codeKey is now deprecated.
8888efe to
15db467
Compare
dcalhoun
left a comment
There was a problem hiding this comment.
🚀 Nicely done! I retested the changes. Thank you.
Related PRs:
Gutenberg Mobile-> [Mobile] - Add new KeyboardEvent.code attribute to RichText onKeyPress event wordpress-mobile/gutenberg-mobile#5114What?
This PR adds the
codeattribute to the key events sent from theAztecViewcomponent.Why?
Since keyCode is deprecated and there's an ongoing effort to replace it with code values, we are adding this on the native side to match with the web editor.
It also fixes a regression with the slash inserter (Autocomplete).
How?
By adding the
codeattribute for the key press events in theAztecViewcomponent. It matches the native key values with the Web API values.Testing Instructions
/in a Paragraph block and type the name of a blockScreenshots or screencast